package nlp.anaylsis;

import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;

import org.wltea.analyzer.IKSegmentation;
import org.wltea.analyzer.Lexeme;

public class TermTokens {

	
	public static void main(String[] args){
		String str="我爱北京天安门";
		qieCi(str);
	}
	
	
	public static List<String> qieCi(String str){
	
		StringReader reader=new StringReader(str);
		List<String> strList=new ArrayList<String>();
		IKSegmentation iks = new IKSegmentation(reader);
		Lexeme next = null;
		while (true) {
			try {
				next = iks.next();
				
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			if (next == null) {
				break;
			}
			String token=next.getLexemeText();
			System.out.print(token+"  ");
			strList.add(token);
		}
		
		return strList;
	}
	
}
